<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <input type="text" v-focus="123">
    </div> 
    <script src="./vue.js"></script>
    <script>
        // 定义一个指令
        Vue.directive("focus",{
            bind(el,binding){
                console.log("初始化调用");
                console.log(el);
                console.log(binding)
            },
            inserted(el,binding){
                console.log("绑定的元素插入到dom中啦")
                el.focus();
            }
        })
        let vm = new Vue({
            el: "#app"
        })
    </script>
</body>

</html>